﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Net.Http;
using System.Web.Http;

namespace Lcygcc.Web.API.Controllers
{
    public class JSController : ApiController
    {
        protected JSController()
        { }

        [HttpGet]
        public string TestApi()
        {
            return "测试接口" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") ;
        }

            #region 警务政通人事接口
            ///// <summary>
            ///// 市局警员基本信息表
            ///// </summary>
            ///// <param name="requestModel"></param>
            ///// <returns></returns>
            //[HttpPost, WriteLog, ActionName("PoliceInfo")]
            //public HttpResponseMessage getPoliceInfo([FromBody]object requestModel)
            //{
            //    Contract.Requires(requestModel != null, "请求参数无效");

            //    PoliceToken = JSOCTNet.TC.Api.Police.OAuthPolice.Instance.GetToken();

            //    JSOCTNet.TC.Models.Police.PoliceRequest requestdata = requestModel.ToString().FromJson<JSOCTNet.TC.Models.Police.PoliceRequest>();
            //    //获取token            
            //    JSOCTNet.TC.Models.Police.PoliceRequest policeRequest = new Models.Police.PoliceRequest();
            //    policeRequest.token = PoliceToken;
            //    policeRequest.pageNum = requestdata.pageNum;
            //    policeRequest.pageSize = requestdata.pageSize;
            //    policeRequest.doCount = requestdata.doCount;
            //    policeRequest.transcoding = requestdata.transcoding;
            //    policeRequest.fields = requestdata.fields;
            //    policeRequest.query = requestdata.query;

            //    string strJson = policeRequest.ToJson();

            //    string basic_url = JSOCTNet.TC.Api.Police.OAuthPolice.PoliceBasicSID;

            //    //写日志
            //    string strResult = HttpHelper.CreateHttpPostResponse(basic_url, strJson);

            //    return new HttpResponseMessage { Content = new StringContent(strResult, System.Text.Encoding.UTF8, "application/json") };

            //}
            ///// <summary>
            ///// 市局警员照片基本信息表
            ///// </summary>
            ///// <param name="requestModel"></param>
            ///// <returns></returns>

            //[HttpPost, WriteLog, ActionName("PolicePhoto")]
            //public HttpResponseMessage getPolicePhoto([FromBody]object requestModel)
            //{
            //    #region
            //    PoliceToken = JSOCTNet.TC.Api.Police.OAuthPolice.Instance.GetToken();

            //    Contract.Requires(requestModel != null, "请求参数无效");
            //    JSOCTNet.TC.Models.Police.PoliceRequest requestdata = requestModel.ToString().FromJson<JSOCTNet.TC.Models.Police.PoliceRequest>();

            //    JSOCTNet.TC.Models.Police.PoliceRequest policeRequest = new Models.Police.PoliceRequest();
            //    policeRequest.token = PoliceToken;
            //    policeRequest.pageNum = requestdata.pageNum;
            //    policeRequest.pageSize = requestdata.pageSize;
            //    policeRequest.doCount = requestdata.doCount;
            //    policeRequest.transcoding = requestdata.transcoding;
            //    policeRequest.fields = requestdata.fields;
            //    policeRequest.query = requestdata.query;

            //    string strJson = policeRequest.ToJson();

            //    //string strJson = JsonHelper.GetJSON<JSOCTNet.TC.Models.Police.PoliceRequest>(policeRequest);

            //    string basic_url = JSOCTNet.TC.Api.Police.OAuthPolice.PolicePhotoSID;

            //    //写日志
            //    string strResult = HttpHelper.CreateHttpPostResponse(basic_url, strJson);

            //    return new HttpResponseMessage { Content = new StringContent(strResult, System.Text.Encoding.UTF8, "application/json") };

            //    //  return Json(strResult);

            //    #endregion

            //    #region
            //    //JSOCTNet.TC.Models.Police.PolicePhotoResponse response = new Models.Police.PolicePhotoResponse();
            //    //response.code = "999999";
            //    //response.time = "1513935966662";

            //    //JSOCTNet.TC.Models.Police.PoliceData subdata = new Models.Police.PoliceData();
            //    //JSOCTNet.TC.Models.Police.PoliceResponseData kedata = new Models.Police.PoliceResponseData();
            //    //subdata.total = "911";
            //    //subdata.data =new List<Models.Police.PoliceResponseData>();
            //    //subdata.data.Add(kedata);

            //    //response.data = subdata;
            //    //response.success = "true";

            //    //string strResponse = response.ToJson();

            //    //  return Json(response);
            //    #endregion
            //}
            ///// <summary>
            ///// 市局单位基本信息表
            ///// </summary>
            ///// <param name="requestModel"></param>
            ///// <returns></returns>

            //[HttpPost, WriteLog, ActionName("DeptInfo")]
            //public HttpResponseMessage getDeptBasicInfo([FromBody]object requestModel)
            //{
            //    Contract.Requires(requestModel != null, "请求参数无效");

            //    PoliceToken = JSOCTNet.TC.Api.Police.OAuthPolice.Instance.GetToken();

            //    JSOCTNet.TC.Models.Police.PoliceRequest requestdata = requestModel.ToString().FromJson<JSOCTNet.TC.Models.Police.PoliceRequest>();
            //    //获取token            
            //    JSOCTNet.TC.Models.Police.PoliceRequest policeRequest = new Models.Police.PoliceRequest();
            //    policeRequest.token = PoliceToken;
            //    policeRequest.pageNum = requestdata.pageNum;
            //    policeRequest.pageSize = requestdata.pageSize;
            //    policeRequest.doCount = requestdata.doCount;
            //    policeRequest.transcoding = requestdata.transcoding;
            //    policeRequest.fields = requestdata.fields;
            //    policeRequest.query = requestdata.query;

            //    string strJson = policeRequest.ToJson();

            //    string basic_url = JSOCTNet.TC.Api.Police.OAuthPolice.DeptBasicSID;

            //    //写日志
            //    string strResult = HttpHelper.CreateHttpPostResponse(basic_url, strJson);

            //    // return Json(strResult);
            //    return new HttpResponseMessage { Content = new StringContent(strResult, System.Text.Encoding.UTF8, "application/json") };

            //    ////写日志
            //    //string strResult = HttpHelper.CreateHttpPostResponse(basic_url, strJson);

            //    #region

            //    //JSOCTNet.TC.Models.Police.PoliceDeptResponse response = new Models.Police.PoliceDeptResponse();
            //    //response.code = "999999";
            //    //response.time = "1513935966662";

            //    //JSOCTNet.TC.Models.Police.PoliceDeptData subdata = new Models.Police.PoliceDeptData();
            //    //JSOCTNet.TC.Models.Police.PoliceDeptResponseData kedata = new Models.Police.PoliceDeptResponseData();
            //    //subdata.total = "901";
            //    //subdata.data = new List<Models.Police.PoliceDeptResponseData>();
            //    //subdata.data.Add(kedata);
            //    //subdata.data.Add(kedata);

            //    //response.data = subdata;
            //    //response.success = "true";

            //    //return Json(response);
            //    #endregion
            //}
            ///// <summary>
            ///// 重大刑事犯罪前科人员信息表
            ///// </summary>
            ///// <param name="requestModel"></param>
            ///// <returns></returns>

            //[HttpPost, WriteLog, ActionName("CriminalOffence")]
            //public HttpResponseMessage getKey_CriminalOffence([FromBody]object requestModel)
            //{
            //    try
            //    {
            //        Contract.Requires(requestModel != null, "请求参数无效");


            //        PoliceToken = JSOCTNet.TC.Api.Police.OAuthPolice.Instance.GetToken();

            //        JSOCTNet.TC.Models.Police.PoliceRequest requestdata = requestModel.ToString().FromJson<JSOCTNet.TC.Models.Police.PoliceRequest>();
            //        //获取token            
            //        JSOCTNet.TC.Models.Police.PoliceRequest policeRequest = new Models.Police.PoliceRequest();
            //        policeRequest.token = PoliceToken;
            //        policeRequest.pageNum = requestdata.pageNum;
            //        policeRequest.pageSize = requestdata.pageSize;
            //        policeRequest.doCount = requestdata.doCount;
            //        policeRequest.transcoding = requestdata.transcoding;
            //        policeRequest.fields = requestdata.fields;
            //        policeRequest.query = requestdata.query;

            //        string strJson = policeRequest.ToJson();

            //        string basic_url = JSOCTNet.TC.Api.Police.OAuthPolice.Key_ES_51_1;
            //        //写日志
            //        Infrastructure.Logging.TextLogger.WriteLog(string.Format("getKey_CriminalOffence:重大刑事犯罪前科人员信息表--token:{0}---data:{1}", PoliceToken, strJson));
            //        string strResult = HttpHelper.CreateHttpPostResponse(basic_url, strJson);

            //        Infrastructure.Logging.TextLogger.WriteLog("返回数据：" + strResult);

            //        return new HttpResponseMessage { Content = new StringContent(strResult, System.Text.Encoding.UTF8, "application/json") };

            //    }
            //    catch (Exception ex)
            //    {
            //        string strResult = "{\"code\":\"999999\",\"time\":1525826098775,\"data\":{\"total\":0,\"data\":[]},\"success\":true}";
            //        Infrastructure.Logging.TextLogger.WriteLog("返回数据：" + strResult);

            //        return new HttpResponseMessage { Content = new StringContent(strResult, System.Text.Encoding.UTF8, "application/json") };

            //    }
            //}
            ///// <summary>
            ///// 在逃人员信息表
            ///// </summary>
            ///// <param name="requestModel"></param>
            ///// <returns></returns>

            //[HttpPost, WriteLog, ActionName("CriminalEscaped")]
            //public HttpResponseMessage getKey_CriminalEscaped([FromBody]object requestModel)
            //{
            //    //  Contract.Requires(requestModel != null, "请求参数无效");
            //    try
            //    {
            //        PoliceToken = JSOCTNet.TC.Api.Police.OAuthPolice.Instance.GetToken();

            //        JSOCTNet.TC.Models.Police.PoliceRequest requestdata = requestModel.ToString().FromJson<JSOCTNet.TC.Models.Police.PoliceRequest>();
            //        //获取token            
            //        JSOCTNet.TC.Models.Police.PoliceRequest policeRequest = new Models.Police.PoliceRequest();
            //        policeRequest.token = PoliceToken;
            //        policeRequest.pageNum = requestdata.pageNum;
            //        policeRequest.pageSize = requestdata.pageSize;
            //        policeRequest.doCount = requestdata.doCount;
            //        policeRequest.transcoding = requestdata.transcoding;
            //        policeRequest.fields = requestdata.fields;
            //        policeRequest.query = requestdata.query;

            //        string strJson = policeRequest.ToJson();

            //        string basic_url = JSOCTNet.TC.Api.Police.OAuthPolice.Key_ES_51_2;

            //        //写日志
            //        Infrastructure.Logging.TextLogger.WriteLog(string.Format("getKey_CriminalEscaped:在逃人员信息表--token:{0}---data:{1}", PoliceToken, strJson));
            //        string strResult = HttpHelper.CreateHttpPostResponse(basic_url, strJson);
            //        Infrastructure.Logging.TextLogger.WriteLog("返回数据：" + strResult);

            //        return new HttpResponseMessage { Content = new StringContent(strResult, System.Text.Encoding.UTF8, "application/json") };
            //    }
            //    catch (Exception ex)
            //    {
            //        string strResult = "{\"code\":\"999999\",\"time\":1525826098775,\"data\":{\"total\":0,\"data\":[]},\"success\":true}";
            //        Infrastructure.Logging.TextLogger.WriteLog("返回数据：" + strResult);

            //        return new HttpResponseMessage { Content = new StringContent(strResult, System.Text.Encoding.UTF8, "application/json") };
            //    }
            //}
            ///// <summary>
            ///// 涉毒人员信息表
            ///// </summary>
            ///// <param name="requestModel"></param>
            ///// <returns></returns>

            //[HttpPost, WriteLog, ActionName("CriminalDruged")]
            //public HttpResponseMessage getKey_CriminalDruged([FromBody]object requestModel)
            //{
            //    try
            //    {
            //        Contract.Requires(requestModel != null, "请求参数无效");

            //        PoliceToken = JSOCTNet.TC.Api.Police.OAuthPolice.Instance.GetToken();

            //        JSOCTNet.TC.Models.Police.PoliceRequest requestdata = requestModel.ToString().FromJson<JSOCTNet.TC.Models.Police.PoliceRequest>();
            //        //获取token            
            //        JSOCTNet.TC.Models.Police.PoliceRequest policeRequest = new Models.Police.PoliceRequest();
            //        policeRequest.token = PoliceToken;
            //        policeRequest.pageNum = requestdata.pageNum;
            //        policeRequest.pageSize = requestdata.pageSize;
            //        policeRequest.doCount = requestdata.doCount;
            //        policeRequest.transcoding = requestdata.transcoding;
            //        policeRequest.fields = requestdata.fields;
            //        policeRequest.query = requestdata.query;

            //        string strJson = policeRequest.ToJson();

            //        string basic_url = JSOCTNet.TC.Api.Police.OAuthPolice.Key_ES_51_3;
            //        //写日志
            //        Infrastructure.Logging.TextLogger.WriteLog(string.Format("getKey_CriminalDruged:涉毒人员信息表--token:{0}---data:{1}", PoliceToken, strJson));
            //        string strResult = HttpHelper.CreateHttpPostResponse(basic_url, strJson);

            //        Infrastructure.Logging.TextLogger.WriteLog("返回数据：" + strResult);

            //        return new HttpResponseMessage { Content = new StringContent(strResult, System.Text.Encoding.UTF8, "application/json") };
            //    }
            //    catch (Exception ex)
            //    {
            //        string strResult = "{\"code\":\"999999\",\"time\":1525826098775,\"data\":{\"total\":0,\"data\":[]},\"success\":true}";
            //        Infrastructure.Logging.TextLogger.WriteLog("返回数据：" + strResult);

            //        return new HttpResponseMessage { Content = new StringContent(strResult, System.Text.Encoding.UTF8, "application/json") };
            //    }
            //    // return Json(strResult);
            //}

            #endregion
        }
    }
